import pymysql

from db_utils import D

if __name__ == '__main__':
    # conn = pymysql.connect(user="root",password="root",host="127.0.0.1",port=3306,database="test")
    # #获取游标对象，执行sql
    # cursor = conn.cursor()
    # sql = "select * from books where authors = %s"
    # q = ["小乔"]
    # #执行sql
    # cursor.execute(sql,q)
    # #获取查询到的信息
    # # stuList = cursor.fetchone()
    # # stuList = cursor.fetchall()
    # stuList = cursor.fetchmany(3)
    # print(stuList)
    # #释放资源
    # cursor.close()
    # conn.cursor()

    utils = D("test")
    sql = "select * from books where authors = %s"
    par = ["小乔"]
    r = utils.selectAll(sql, par)
    print(r)
